<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<html>
<head>

</head>
<body>

<div id="toolbar">
    <shiro:hasPermission name="user:create">
        <a href="javascript:void(0);" onclick="addUser('${pageContext.request.contextPath}/user/create');"
           class="easyui-linkbutton" data-options="iconCls:'icon-add'">用户新增</a>
    </shiro:hasPermission>
    <shiro:hasPermission name="user:update">
        <a href="javascript:void(0);" onclick="updateUser('${pageContext.request.contextPath}/user/userId/update');"
           class="easyui-linkbutton" data-options="iconCls:'icon-edit'">修改</a>
    </shiro:hasPermission>
    <shiro:hasPermission name="user:delete">
        <a href="javascript:void(0);" onclick="deleteUser('${pageContext.request.contextPath}/user/userId/delete');"
           class="easyui-linkbutton" data-options="iconCls:'icon-delete'">删除</a>
    </shiro:hasPermission>
</div>

<table class="easyui-datagrid" id="dg">
</table>
<script>
    $(function () {
        initUserData();
    });
    // 初始化用户列表
    function initUserData() {
        $('#dg').datagrid({
            toolbar: $('#toolbar'),
            url: '${pageContext.request.contextPath}/user/list',
            columns: [[
                {field: 'id', hidden: true},
                {field: 'username', title: '用户名'},
                {field: 'locked', title: '是否锁定'}
            ]],
            pagination: true,
            method: 'get',
            fit: true,
            fitColumns: true
        });
    }

    // 添加用户
    function addUser(url) {

    }

    // 修改用户
    function updateUser(url) {

    }

    // 删除用户
    function deleteUser(url) {

    }
</script>
</body>
</html>